<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/public/header.jsp"%>
<%
	String detail_id = request.getParameter("detail_id") == null ? "" : request.getParameter("detail_id");
	String supplier_id = request.getParameter("supplier_id") == null ? "" : request.getParameter("supplier_id");
%>
<html>
	<head>
		<title>往来流水</title>
	</head>
	<script type="text/javascript">
		$(function(){
			$('#table').datagrid({
				title:'往来流水',
				rownumber:true,
				url:'<%=contextPath %>/springMVC/crm/listPageSupplierFinanceOutLog?detail_id=<%=detail_id%>', 
				loadMsg:'正在加载数据，请稍后......',
				fitColumns:true,
				nowrap:false,
				columns:[[
					{title:'id',field:'id',hidden:true},
					{title:'工单id',field:'gd_id',hidden:true},
					{title:'时间',field:'operation_date',width:200,align:'center'},
					{title:'摘要',field:'summary',width:300,align:'center'},
					{title:'之前应付',field:'before_finance_out',width:100,align:'center'},
					{title:'本次发生额',field:'finance_out',width:100,align:'center'},
					{title:'之后应付',field:'after_finance_out',width:100,align:'center'},
					{title:'查看凭证',field:'detial',width:50,align:'center',formatter:function(value,rowData,rowIndex){
						return "<input type='button'   style='border:0px #ff0000 solid;width:16px;height:16px;cursor:pointer;' class='icon-details'    onclick=\"javascript:showDetail('"+ rowData.proof_type +"','"+ rowData.proof_id +"','"+rowData.gd_id+"');\">";
					}}
				]],
				pageSize:10,
				pageList : [10,50,100],  
				pagination:true,
				onLoadSuccess:function(rtJson){
					if(rtJson.rtState== '1')
					{
						warningInfo(rtJson.rtMsrg);
					}
				}
			});
			//----end
		});
		function doSearch(){
			var start_date = $('#start_date').datebox('getValue');
			var end_date = $('#end_date').datebox('getValue');
			$('#table').datagrid('load',{
				start_date:start_date,
				end_date:end_date,
				detail_id:'<%=detail_id%>'
			});
		}
		function showDetail(proof_type,proof_id,gd_id){
			if(proof_type == '<%=com.beaut.project.util.StaticData.CRM_SUPPLIER_PRODUCT_IN%>'){
				openDialogResize('<%=contextPath %>/springViews/warehouse/addOrEditPurchaseProductIn.jsp?isShow=1&product_in_id='+proof_id,1000, 800);
			}
			if(proof_type == '<%=com.beaut.project.util.StaticData.XM_SUPPLIER_PROCESS_FINANCE_OUT%>'){
				openDialogResize('<%=contextPath %>/springViews/xm/viewSupplyPayment.jsp?isShow=1&id='+proof_id,1000, 800);
			}
			if(proof_type == '<%=com.beaut.project.util.StaticData.XM_SUPPLIER_END_FINANCE_OUT%>'){
				openDialogResize('<%=contextPath %>/springViews/xm/xmBalancePurchase.jsp?isShow=1&xm_id='+proof_id,1000, 800);
			}
			if(proof_type == '<%=com.beaut.project.util.StaticData.CRM_SUPPLIER_BC_PRODUCT%>'){
				openDialogResize('<%=contextPath %>/springViews/warehouse/addOrEditSupplierPurchase.jsp?isShow=1&purchase_id='+proof_id+'&supplier_id=<%=supplier_id%>&gd_id='+gd_id,1000, 800);

			}
		}
	</script>
	<body>
		    	    <div id="table"  data-options="fit:true,toolbar:'#queryParamDiv'"></div>  
		    	    <div id="queryParamDiv" style="padding:3px;height:auto">
						<div align="right">
							开始日期: <input id="start_date" name="start_date" class="easyui-datebox" />
							结束日期: <input id="end_date" name="end_date" class="easyui-datebox" />&nbsp;&nbsp;
							<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="doSearch();">搜索</a>
						</div>
					</div>
	</body>
</html>
